﻿Partial Public Class ExceptionDialog

    Public Sub New(ByVal ex As Exception)

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        Me.DataContext = ex

    End Sub

    Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        Me.DialogResult = True
        Me.Close()
    End Sub

    Private Sub CopyToClipboardHyperlink_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)

        Dim ex As Exception = DirectCast(Me.DataContext, Exception)

        Dim msg As New Text.StringBuilder

        msg.Append("Message: ")
        msg.Append(ex.Message)
        msg.AppendLine()

        msg.Append("StackTrace: ")
        msg.Append(ex.StackTrace)
        msg.AppendLine()

        Clipboard.SetText(msg.ToString())

    End Sub
End Class
